using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Localization;
using SinBiota.Model.Entities.CustomAttributes;

namespace SinBiota.Model.Entities
{
    [LocalizedName("Project", NameResourceType = typeof(Strings))]
    public class Project : BaseEntity
    {

        [LocalizedName("Name", NameResourceType = typeof(Strings))]
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "FieldCannotBeEmpty")]
        public virtual String Name { get; set; }

        [LocalizedName("Coordinators", NameResourceType = typeof(Strings))]
        public virtual IList<User> Coordinators { get; private set; }

        [LocalizedName("Members", NameResourceType = typeof(Strings))]
        public virtual IList<User> Members { get; private set; }

        [LocalizedName("Objectives", NameResourceType = typeof(Strings))]
        public virtual String Objectives { get; set; }

        [LocalizedName("TeamDescription", NameResourceType = typeof(Strings))]
        public virtual String TeamDescription { get; set; }

        [LocalizedName("ParticipatingInstitutions", NameResourceType = typeof(Strings))]
        public virtual String ParticipatingInstitutions { get; set; }

        [LocalizedName("ExpectedProducts", NameResourceType = typeof(Strings))]
        public virtual String ExpectedProducts { get; set; }

        [LocalizedName("ProjectStatus", NameResourceType = typeof(Strings))]
        public virtual ProjectStatus ProjectStatus { get; set; }


        [LocalizedName("FAPESPProject", NameResourceType = typeof(Strings))]
        public virtual bool FAPESPProject { get; set; }

        [LocalizedName("WebsiteURL", NameResourceType = typeof(Strings))]
        public virtual string WebsiteURL { get; set; }

        [LocalizedName("StartDate", NameResourceType = typeof(Strings))]
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "FieldCannotBeEmpty")]
        [ValidDate(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "InvalidDateFormat")]
        public virtual string StartDate { get; set; }

        [ValidDate(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "InvalidDateFormat")]
        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "FieldCannotBeEmpty")]
        [LocalizedName("EndDate", NameResourceType = typeof(Strings))]
        public virtual string EndDate { get; set; }

        [LocalizedName("Biome", NameResourceType = typeof(Strings))]
        public virtual string Biome { get; set; }

        [Required(ErrorMessageResourceType = typeof(Messages), ErrorMessageResourceName = "FieldCannotBeEmpty")]
        [LocalizedName("Abstract", NameResourceType = typeof(Strings))]
        public virtual string Abstract { get; set; }

        [LocalizedName("Keywords", NameResourceType = typeof(Strings))]
        public virtual IList<Keyword> Keywords { get; private set; }

        [LocalizedName("Occurrences", NameResourceType = typeof(Strings))]
        public virtual IList<Occurrence> Occurrences { get; private set; }

        public Project()
        {
            Coordinators = new List<User>();
            Members = new List<User>();
            Keywords = new List<Keyword>();
            Occurrences = new List<Occurrence>();
        }
    }

    public enum ProjectStatus
    {
        Finished = 1, InProgress = 2, Processing = 3
    }
}
